<?php
namespace api\modules\v1\controllers;

use api\modules\v1\models\userFund\WithdrawOrder;
use Yii;
use yii\helpers\ArrayHelper;
use yii\filters\auth\HttpHeaderAuth;

class WithdrawController extends DefaultController
{
    public $modelClass = '';

    public function behaviors()
    {
        return ArrayHelper::merge(parent::behaviors(), [
            'authenticator' => [
                'class' =>  HttpHeaderAuth::className(),    //head头部验证
                'header' => 'access-token',
                'optional' => []
            ]
        ]);
    }

    
    public function actionConfig() {
        if (Yii::$app->request->isGet) {
            return (new WithdrawOrder())->getConfig();
        }
    }

    public function actionHistory($page = 1, $size = 20) {
        if (Yii::$app->request->isGet) {
            return (new WithdrawOrder())->getHistory($page, $size);
        }
    }

    public function actionOrder() {
        if (Yii::$app->request->isPost) {
            return (new WithdrawOrder())->createOrder();
        }
    }
}
